load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "fileset",
    srcs = [
        "buffer.go",
        "compaction.go",
        "dir_inserter.go",
        "fileset.go",
        "fileset.pb.go",
        "fileset.pb.validate.go",
        "fileset.pb.zap.go",
        "merge.go",
        "metadata_store.go",
        "option.go",
        "pin.go",
        "postgres_cache.go",
        "postgres_store.go",
        "prefetcher.go",
        "reader.go",
        "renewer.go",
        "shard.go",
        "storage.go",
        "transforms.go",
        "unordered_writer.go",
        "util.go",
        "validator.go",
        "writer.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/storage/fileset",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/internal/backoff",
        "//src/internal/dbutil",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/log",
        "//src/internal/miscutil",
        "//src/internal/pacherr",
        "//src/internal/pachhash",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/require",
        "//src/internal/storage/chunk",
        "//src/internal/storage/fileset/index",
        "//src/internal/storage/renew",
        "//src/internal/storage/track",
        "//src/internal/stream",
        "//src/internal/tarutil",
        "//src/internal/taskchain",
        "//src/internal/uuid",
        "//src/pfs",
        "@com_github_docker_go_units//:go-units",
        "@com_github_hashicorp_golang_lru_v2//:golang-lru",
        "@com_github_jmoiron_sqlx//:sqlx",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//reflect/protoreflect",
        "@org_golang_google_protobuf//runtime/protoimpl",
        "@org_golang_google_protobuf//types/known/anypb",
        "@org_golang_x_sync//errgroup",
        "@org_golang_x_sync//semaphore",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "fileset_test",
    size = "large",
    srcs = [
        "chunkset_test.go",
        "compaction_test.go",
        "fileset_test.go",
        "gc_test.go",
        "postgres_cache_test.go",
        "postgres_store_test.go",
        "prefetcher_test.go",
    ],
    embed = [":fileset"],
    shard_count = 8,
    tags = ["cpu:4"],
    deps = [
        "//src/internal/clusterstate",
        "//src/internal/dbutil",
        "//src/internal/dockertestenv",
        "//src/internal/errors",
        "//src/internal/migrations",
        "//src/internal/miscutil",
        "//src/internal/pacherr",
        "//src/internal/pachhash",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/randutil",
        "//src/internal/require",
        "//src/internal/storage/chunk",
        "//src/internal/storage/fileset/index",
        "//src/internal/storage/kv",
        "//src/internal/storage/track",
        "//src/internal/testetcd",
        "@com_github_docker_go_units//:go-units",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//types/known/anypb",
        "@org_golang_x_sync//errgroup",
    ],
)

filegroup(
    name = "protos",
    srcs = glob(["*.proto"]),
    visibility = ["//src:__pkg__"],
)
